// 住户管理
import {
    ajaxPostBack,
    ajaxPost,
    download
} from '@/utils/data/request'
// 访客人员列表
export function guestList(params: any) {
    return ajaxPostBack("holder/guest-list", params, {
        cookies: ['yard_sn']
    })
}

// 访客新增
export function addGuest(params: any) {
    return ajaxPost("holder/guest-create", params, { successMessage: true, cookies: ['yard_sn'] })
}

// 访客删除
export function delGuest({ member_sn }: any) {
    return ajaxPost("holder/guest-delete", { member_sn }, { successMessage: true, cookies: ['yard_sn'] })
}

// 列表
export function list(params: any) {
    return ajaxPostBack("holder/member-list", params, {
        cookies: ['yard_sn']
    })
}
// 导出
export function downloadFile(params: any) {
    const file = "住户人员列表" + Date.now().toString() + '.xls';
    return download('holder/member-export', params, file, {
        cookies: ['yard_sn'],
        method: 'post'
    });
}

// 导入
export function importData (params: any) {
    return ajaxPost("holder/member-import", params, {
      successMessage: true,
      cookies: ["yard_sn"]
    });
}
  

// 编辑
export function edit(params: any) {
    return ajaxPost("holder/member-edit", params, { successMessage: true, cookies: ['yard_sn'] })
}

// 新增
export function add(params: any) {
    return ajaxPost("holder/member-create", params, { successMessage: true, cookies: ['yard_sn'] })
}

// 删除
export function del({ member_sn }: any) {
    return ajaxPost("holder/member-delete", { member_sn }, { successMessage: true, cookies: ['yard_sn'] })
}

// APP授权
export function auth(params: any) {
    return ajaxPost("holder/member-appauth", params, { successMessage: true, cookies: ['yard_sn'] })
}

// 房间住户列表
export function room(params: any) {
    return ajaxPost("house/room-member-list", params, {
        cookies: ['yard_sn']
    })
}
